

import 'package:huajianshe_app/network/response/BaseResp.dart';
import 'package:huajianshe_app/pages/circle/model/CircleModel.dart';
import 'package:huajianshe_app/pages/user_info/model/UserModel.dart';
import 'package:json_annotation/json_annotation.dart';

part 'MomentModel.g.dart';

@JsonSerializable()
class Pager {
  int? total;
  @JsonKey(name: 'current_page')
  int? current;
  @JsonKey(name: 'last_page')
  int? last;
}

@JsonSerializable()
class MomentListResp extends BaseResp {

  MomentListPager? data;

  MomentListResp();

  factory MomentListResp.fromJson(Map<String, dynamic> json) => _$MomentListRespFromJson(json);

  @override
  MomentListResp parseFromMap(Map<String, dynamic> map) {
    return MomentListResp.fromJson(map);
  }
}

@JsonSerializable()
class MomentListPager extends Pager {
  List<MomentListData>? data;

  MomentListPager();

  factory MomentListPager.fromJson(Map<String, dynamic> json) => _$MomentListPagerFromJson(json);

}

@JsonSerializable()
class MomentListData {

  int? id;

  @JsonKey(name: 'blog_sn')
  String? postSn;

  int? type;

  @JsonKey(name: 'member_sn')
  String? memberSn;

  String? content;

  @JsonKey(name: 'collect_num')
  int? collectNum;

  @JsonKey(name: 'is_collect')
  int? isCollect;

  @JsonKey(name: 'comment_num')
  int? commentNum;
  //
  @JsonKey(name: 'pic_urls_arr')
  List<String>? imgUrls;
  //
  @JsonKey(name: 'video_urls_box')
  List<VideoInfo>? videoInfo;
  //
  @JsonKey(name: 'blog_circle_list')
  List<CircleInfo>? circles;
  //
  @JsonKey(name: 'member_info_box')
  UserInfo? userInfo;

  @JsonKey(name: 'create_time_friendly')
  String? postDataTime;

  MomentListData();

  factory MomentListData.fromJson(Map<String, dynamic> json) => _$MomentListDataFromJson(json);
}

@JsonSerializable()
class VideoInfo {
  @JsonKey(name: 'video_url')
  String? videoUrl;
  @JsonKey(name: 'cover_url')
  String? coverUrl;

  VideoInfo();

  factory VideoInfo.fromJson(Map<String, dynamic> json) => _$VideoInfoFromJson(json);
}

@JsonSerializable()
class MomentMonthListResp extends BaseResp {
  List<MomentMonthData>? data;

  MomentMonthListResp();

  factory MomentMonthListResp.fromJson(Map<String, dynamic> json) => _$MomentMonthListRespFromJson(json);

  @override
  MomentMonthListResp parseFromMap(Map<String, dynamic> map) {
    return MomentMonthListResp.fromJson(map);
  }
}

@JsonSerializable()
class MomentMonthData {
  String? month;
  @JsonKey(name: 'view_num')
  int? viewNum;
  @JsonKey(name: 'total_blog_num')
  int? total;
  @JsonKey(name: 'blog_list')
  List<MomentListData>? posts;

  MomentMonthData();

  factory MomentMonthData.fromJson(Map<String, dynamic> json) => _$MomentMonthDataFromJson(json);
}